<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Command-module for SharpReader feed aggregator &mdash; Dragonfly-modules v0.1 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Dragonfly-modules v0.1 documentation" href="index.html" />
    <link rel="next" title="Command-module for Audacity, an audio-editing application" href="mod-_audacity.html" />
    <link rel="prev" title="Command-module for controlling TortoiseSVN from Windows Explorer" href="mod-_tortoisesvn.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="mod-_audacity.html" title="Command-module for Audacity, an audio-editing application"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mod-_tortoisesvn.html" title="Command-module for controlling TortoiseSVN from Windows Explorer"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Dragonfly-modules v0.1 documentation</a> &raquo;</li> 
      </ul>
    </div>  
    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  
  <div class="section" id="command-module-for-sharpreader-feed-aggregator">
<h1>Command-module for <strong>SharpReader</strong> feed aggregator<a class="headerlink" href="#command-module-for-sharpreader-feed-aggregator" title="Permalink to this headline">¶</a></h1>
<p>This module offers various commands for <a class="reference external" href="http://www.sharpreader.net/">SharpReader</a>, a free lightweight feed
aggregator.</p>
<div class="section" id="commands">
<h2>Commands<a class="headerlink" href="#commands" title="Permalink to this headline">¶</a></h2>
<dl class="docutils">
<dt>Command: <strong>&#8220;[feed] address [bar]&#8221;</strong></dt>
<dd>Shift focus to the address bar.</dd>
<dt>Command: <strong>&#8220;subscribe [[to] [this] feed]&#8221;</strong></dt>
<dd>Add the current feed to the list of subscriptions.</dd>
<dt>Command: <strong>&#8220;paste [feed] address&#8221;</strong></dt>
<dd>Paste the contents of the clipboard into the address bar.</dd>
<dt>Command: <strong>&#8220;feeds | feed (list | window | win)&#8221;</strong></dt>
<dd>Shift focus to the list of subscribed feeds.</dd>
<dt>Command: <strong>&#8220;newer [&lt;n&gt;]&#8221;</strong></dt>
<dd>Move up the list of items.  If <em>n</em> is given, move up
the number of items.</dd>
<dt>Command: <strong>&#8220;older [&lt;n&gt;]&#8221;</strong></dt>
<dd>Move down the list of items.  If <em>n</em> is given, move down
the number of items.</dd>
</dl>
</div>
<div class="section" id="module-source-code">
<h2>Module source code<a class="headerlink" href="#module-source-code" title="Permalink to this headline">¶</a></h2>
<p>The most current version of this module can be downloaded from the <a class="reference external" href="http://dragonfly-modules.googlecode.com/svn/trunk/command-modules/sharpreader.py">repository here</a>.</p>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><pre> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91</pre></td><td class="code"><div class="highlight"><pre><span class="c">#</span>
<span class="c"># This file is a command-module for Dragonfly.</span>
<span class="c"># (c) Copyright 2008 by Christo Butcher</span>
<span class="c"># Licensed under the LGPL, see &lt;http://www.gnu.org/licenses/&gt;</span>
<span class="c">#</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Command-module for **SharpReader** feed aggregator</span>
<span class="sd">==================================================</span>

<span class="sd">This module offers various commands for `SharpReader</span>
<span class="sd">&lt;http://www.sharpreader.net/&gt;`_, a free lightweight feed</span>
<span class="sd">aggregator.</span>

<span class="sd">Commands</span>
<span class="sd">--------</span>

<span class="sd">Command: **&quot;[feed] address [bar]&quot;**</span>
<span class="sd">    Shift focus to the address bar.</span>

<span class="sd">Command: **&quot;subscribe [[to] [this] feed]&quot;**</span>
<span class="sd">    Add the current feed to the list of subscriptions.</span>

<span class="sd">Command: **&quot;paste [feed] address&quot;**</span>
<span class="sd">    Paste the contents of the clipboard into the address bar.</span>

<span class="sd">Command: **&quot;feeds | feed (list | window | win)&quot;**</span>
<span class="sd">    Shift focus to the list of subscribed feeds.</span>

<span class="sd">Command: **&quot;newer [&lt;n&gt;]&quot;**</span>
<span class="sd">    Move up the list of items.  If *n* is given, move up</span>
<span class="sd">    the number of items.</span>

<span class="sd">Command: **&quot;older [&lt;n&gt;]&quot;**</span>
<span class="sd">    Move down the list of items.  If *n* is given, move down</span>
<span class="sd">    the number of items.</span>

<span class="sd">&quot;&quot;&quot;</span>


<span class="c">#---------------------------------------------------------------------------</span>

<span class="kn">from</span> <span class="nn">dragonfly.all</span> <span class="kn">import</span> <span class="p">(</span><span class="n">Grammar</span><span class="p">,</span> <span class="n">AppContext</span><span class="p">,</span> <span class="n">Rule</span><span class="p">,</span> <span class="n">MappingRule</span><span class="p">,</span>
                           <span class="n">Dictation</span><span class="p">,</span> <span class="n">Alternative</span><span class="p">,</span> <span class="n">Choice</span><span class="p">,</span> <span class="n">RuleRef</span><span class="p">,</span>
                           <span class="n">Key</span><span class="p">,</span> <span class="n">Text</span><span class="p">,</span>
                           <span class="n">Config</span><span class="p">,</span> <span class="n">Section</span><span class="p">,</span> <span class="n">Item</span><span class="p">)</span>
<span class="kn">from</span> <span class="nn">dragonfly.grammar.integer_en</span>  <span class="kn">import</span> <span class="n">Integer</span><span class="p">,</span> <span class="n">Digits</span>


<span class="c">#---------------------------------------------------------------------------</span>
<span class="c"># Create the main command rule.</span>

<span class="k">class</span> <span class="nc">CommandRule</span><span class="p">(</span><span class="n">MappingRule</span><span class="p">):</span>

    <span class="n">mapping</span>  <span class="o">=</span> <span class="p">{</span>
                <span class="s">&quot;[feed] address [bar]&quot;</span><span class="p">:</span>                <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d&quot;</span><span class="p">),</span>
                <span class="s">&quot;subscribe [[to] [this] feed]&quot;</span><span class="p">:</span>        <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-u&quot;</span><span class="p">),</span>
                <span class="s">&quot;paste [feed] address&quot;</span><span class="p">:</span>                <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d, c-v, enter&quot;</span><span class="p">),</span>
                <span class="s">&quot;feeds | feed (list | window | win)&quot;</span><span class="p">:</span>  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d, tab:2, s-tab&quot;</span><span class="p">),</span>
                <span class="s">&quot;down [&lt;n&gt;] (feed | feeds)&quot;</span><span class="p">:</span>           <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d, tab:2, s-tab, down:</span><span class="si">%(n)d</span><span class="s">&quot;</span><span class="p">),</span>
                <span class="s">&quot;up [&lt;n&gt;] (feed | feeds)&quot;</span><span class="p">:</span>             <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d, tab:2, s-tab, up:</span><span class="si">%(n)d</span><span class="s">&quot;</span><span class="p">),</span>
                <span class="s">&quot;open [item]&quot;</span><span class="p">:</span>                         <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d, tab:2, c-s&quot;</span><span class="p">),</span>
                <span class="s">&quot;newer [&lt;n&gt;]&quot;</span><span class="p">:</span>                         <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d, tab:2, up:</span><span class="si">%(n)d</span><span class="s">&quot;</span><span class="p">),</span>
                <span class="s">&quot;older [&lt;n&gt;]&quot;</span><span class="p">:</span>                         <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-d, tab:2, down:</span><span class="si">%(n)d</span><span class="s">&quot;</span><span class="p">),</span>
                <span class="s">&quot;mark all [as] read&quot;</span><span class="p">:</span>                  <span class="n">Key</span><span class="p">(</span><span class="s">&quot;cs-r&quot;</span><span class="p">),</span>
                <span class="s">&quot;mark all [as] unread&quot;</span><span class="p">:</span>                <span class="n">Key</span><span class="p">(</span><span class="s">&quot;cs-u&quot;</span><span class="p">),</span>
                <span class="s">&quot;search [bar]&quot;</span><span class="p">:</span>                        <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-s&quot;</span><span class="p">),</span>
                <span class="s">&quot;search [for] &lt;text&gt;&quot;</span><span class="p">:</span>                 <span class="n">Key</span><span class="p">(</span><span class="s">&quot;a-s&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">Text</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%(text)s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">),</span>
               <span class="p">}</span>
    <span class="n">extras</span>   <span class="o">=</span> <span class="p">[</span>
                <span class="n">Integer</span><span class="p">(</span><span class="s">&quot;n&quot;</span><span class="p">,</span> <span class="mf">1</span><span class="p">,</span> <span class="mf">20</span><span class="p">),</span>
                <span class="n">Dictation</span><span class="p">(</span><span class="s">&quot;text&quot;</span><span class="p">),</span>
               <span class="p">]</span>
    <span class="n">defaults</span> <span class="o">=</span> <span class="p">{</span>
                <span class="s">&quot;n&quot;</span><span class="p">:</span> <span class="mf">1</span><span class="p">,</span>
               <span class="p">}</span>


<span class="c">#---------------------------------------------------------------------------</span>
<span class="c"># Create and load this module&#39;s grammar.</span>

<span class="n">context</span> <span class="o">=</span> <span class="n">AppContext</span><span class="p">(</span><span class="n">executable</span><span class="o">=</span><span class="s">&quot;SharpReader&quot;</span><span class="p">)</span>
<span class="n">grammar</span> <span class="o">=</span> <span class="n">Grammar</span><span class="p">(</span><span class="s">&quot;sharp reader&quot;</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">)</span>
<span class="n">grammar</span><span class="o">.</span><span class="n">add_rule</span><span class="p">(</span><span class="n">CommandRule</span><span class="p">())</span>
<span class="n">grammar</span><span class="o">.</span><span class="n">load</span><span class="p">()</span>

<span class="c"># Unload function which will be called by natlink at unload time.</span>
<span class="k">def</span> <span class="nf">unload</span><span class="p">():</span>
    <span class="k">global</span> <span class="n">grammar</span>
    <span class="k">if</span> <span class="n">grammar</span><span class="p">:</span> <span class="n">grammar</span><span class="o">.</span><span class="n">unload</span><span class="p">()</span>
    <span class="n">grammar</span> <span class="o">=</span> <span class="bp">None</span>
</pre></div>
</td></tr></table></div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">Command-module for <strong>SharpReader</strong> feed aggregator</a><ul>
<li><a class="reference external" href="#commands">Commands</a></li>
<li><a class="reference external" href="#module-source-code">Module source code</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="mod-_tortoisesvn.html" title="previous chapter">Command-module for controlling <strong>TortoiseSVN</strong> from Windows Explorer</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="mod-_audacity.html" title="next chapter">Command-module for <strong>Audacity</strong>, an audio-editing application</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/mod-sharpreader.txt">Show Source</a></li>
            </ul>
          <h3>Quick search</h3>
            <form class="search" action="search.html" method="get">
              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
              <input type="hidden" name="check_keywords" value="yes" />
              <input type="hidden" name="area" value="default" />
            </form>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="mod-_audacity.html" title="Command-module for Audacity, an audio-editing application"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mod-_tortoisesvn.html" title="Command-module for controlling TortoiseSVN from Windows Explorer"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Dragonfly-modules v0.1 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2008, Christo Butcher.
      Last updated on Apr 10, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
    </div>
  </body>
</html>